<?php
/**
 * Created by PhpStorm.
 * User: eppo.Wan
 * Date: 2017/11/16
 * Time: 11:02
 */
use yii\helpers\Html;
use yii\widgets\LinkPager;
use yii\helpers\Url;
?>
<div style="height:5px"></div>
<div class="btn-group" style="float: right;">
    <a href="<?=Url::toRoute(['admin/addmanager']);?>" class="btn btn-warning">添加支部管理员</a>
</div>
<table id="dnd-example" cellspacing="0" class="table table-striped table-hover">
    <thead>
    <tr>
        <th>真实姓名</th>
        <th>所属支部</th>
        <th>电话</th>
        <th>类型</th>
        <th>管理操作</th>
    </tr>
    </thead>

    <?php  
        $values=$dataProvider->getModels();
        foreach($values as $value):
    ?>
    <tr id="admin_<?=$value->id;?>">
        <td><?=$value->realname?$value->realname:$value->username; ?></td>
        <td><?=$model_user->getBranch($value->branch_id)->name;?></td>
        <td><?= $value->tel?></td>
        <td><?=$value->mtype?></td>
        <td>
            <a href="<?=Url::toRoute(['delmanager','id'=>$value->id]);?>" onclick="return del()">
                <button type="button" class="btn btn-danger">删除</button>
            </a>
        </td>
    </tr>
    <?php endforeach; ?>

</table>
<?php
$pages=$dataProvider->getPagination();
echo LinkPager::widget([
    'pagination' => $pages,
]);

?>

<?php $this->beginBlock('del') ?>

//    删除栏目
    function del(id){
        var is_del = confirm('确定取消该成员的支部管理权限');
        if(!is_del){
            return false;
        }
    }
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['del'], \yii\web\View::POS_END); ?>